package com.example.service.impl;

import com.example.mapper.OperateLogMapper;
import com.example.pojo.OperateLog;
import com.example.pojo.OperateLogQueryParam;
import com.example.pojo.PageResult;
import com.example.service.OperateLogService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OperateLogServiceImpl implements OperateLogService {

    @Autowired
    private OperateLogMapper operateLogMapper;

    /**
     * 分页查询操作日志
     */
    @Override
    public PageResult<OperateLog> page(OperateLogQueryParam operateLogQueryParam) {
        PageHelper.startPage(operateLogQueryParam.getPage(), operateLogQueryParam.getPageSize());

        Page<OperateLog> p = (Page<OperateLog>) operateLogMapper.list();

        return new PageResult<>(p.getTotal(), p.getResult());
    }
}
